﻿using BarManager.Core.ApplicationService.Interfaces;
using BarManager.Core.BusinessRules.Interfaces.Validator;
using BarManager.Core.DomainModel;
using BarManager.Core.DomainService;
using BarManager.Core.Entity;
using System.Collections.Generic;

namespace BarManager.Core.ApplicationService
{
    public class CategoriaService : BaseApplicationService<Categoria>, ICategoriaService
    {
        private ICategoriaRepository Repository
        {
            get { return (ICategoriaRepository)this.BaseRepository; }
        }

        public CategoriaService(IObjectContext context, ICategoriaRepository repository, ICategoriaValidator validator)
            : base(context, repository, validator)
        {
        }

        //- Categorias que tengan productos
        public IEnumerable<Categoria> GetAllCategoriasContainsProductos()
        {
            return Repository.Find(x => x.ProductoList.Count > 0);
        }      
    }
}
